<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('主库存查询')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">

        <div class="col-sm-12 search-collapse">
            <form id="ordinary-form">
                <div class="select-list">
                    <ul>
                        <li>
                            物料编码：<input type="text" name="productId" th:value="${productId}"/>
                            <input type="hidden" id="stockoutDetailId" th:id="stockoutDetailId" th:value="${stockoutDetailId}"/>
                        </li>
                        <li>
                            物料名称：<input type="text" name="productName"/>
                            <input type="text" name="stockStatus" value="0" hidden/>
                        </li>
                        <li>
                            母件码：<input type="text" name="barcode"/>
                        </li>
                        <li>
                            仓库：<input type="text" name="warehouseId"th:value="${warehouseId}"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "stockout/stockout";
    var datas = [[${@dict.getType('sys_normal_disable')}]];

    $(function() {
        var options = {
            url: prefix + "/listStockMain",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            clickToSelect: true,
            columns: [{
                radio: true
            },
                {
                    field: 'stockId',
                    title: '子库存Id'
                },
                {
                    field: 'stockMainId',
                    title: '主库存Id'
                },
                {
                    field: 'productId',
                    title: '物料编码'
                },
                {
                    field: 'quantity',
                    title: '齐套数量'
                },
                {
                    field: 'inQuantity',
                    title: '已入库数量'
                },
                {
                    field: 'uniform',
                    title: '是否齐套'
                },
                {
                    field: 'barcode',
                    title: '母件码'
                },
                {
                    field: 'barcodeDetail',
                    title: '子件码'
                },
                {
                    field: 'outQuantity',
                    title: '出库数量'
                },
                {
                    field: 'trayCode',
                    title: '托盘码'
                }
                ]
        };
        $.table.init(options);
    });

    function getSelections() {
        //return $.table.selectFirstColumns();
        return $.table.selectColumns("stockMainId");//指定被选择列
    }
    //回传子单据号stockoutDetailId
    function getDetailId() {
        //return $.table.selectFirstColumns();
        return $('#stockoutDetailId').val();
    }
</script>
</body>
</html>